package com.hk.mini;


import lombok.Data;


@Data
public class MiniProtocol {
    //起始头FEFE
    private int head = MiniHead.HEAD_DATA;
    //后续长度xxxx 2字节
    private int len ;
    //内容
    private byte[] data;


    public MiniProtocol(int len, byte[] data){
        this.len = len;
        this.data = data;
    }

    @Override
    public String toString() {

        String head = String.format("%04x",(short)this.head);
        String len = String.format("%04x",(short)this.len);
        String data = MBUtil.byteToHexString(this.data);

        String result =head+len+data;

        result =result.toUpperCase();

        return result;
    }
}
